-- 来自鹿十七6.0
----山岗
function kaisa_enc(code)
    local suiji

    function suiji()
        local code = ''
        for i = 1, 4 do
            if i % 2 == 0 then
                i = 96 + math.random(1, 26)
            else
                i = 64 + math.random(1, 26)
            end
            code = code .. string.char(i)
        end
        return code
    end

    local jia, ascll_tb, ascll_name, ascll_code, ascll_num, pianyi1,
          ascll_name2, ascll_code2, ascll_num2, pianyi2, chongfu
    ascll_tb = {}
    ascll_name = suiji() -- '_' .. math.random(1, 9999)
    ascll_code = 'local ' .. ascll_name .. '={'
    ascll_num = 0
    pianyi1 = math.random(1, 256)

    ascll_name2 = suiji() -- '_' .. math.random(1, 9999)
    ascll_code2 = 'local ' .. ascll_name2 .. '={'
    ascll_num2 = 0
    pianyi2 = math.random(1, 256)

    chongfu = {}
    function jia(code)
        if code == '' then return '""' end
        local num = chongfu[code]
        if not num then
            local config = '{'
            for k, v in pairs({string.byte(code, 1, -1)}) do
                v = tostring(v)
                index = ascll_tb[v]
                if not index then
                    ascll_num = ascll_num + 1
                    ascll_code = ascll_code .. (v + pianyi1) .. ','
                    ascll_tb[v] = ascll_num
                    index = ascll_num
                end
                config = config .. (index + pianyi2) .. ','
            end
            config = string.sub(config, 1, -2) .. '}'
            ascll_code2 = ascll_code2 .. config .. ','
            ascll_num2 = ascll_num2 + 1
            num = ascll_num2
            chongfu[code] = num
        end
        return ascll_name2 .. '[' .. num .. ']'
    end
    -- code = code:gsub('\\', '\092\092')
    code = code:gsub('\092\034', '\034')
    code = code:gsub("\092\039", '\039')
    code = code:gsub("\n", "\n")
    code = code:gsub("%[=%[(.-)%]=%]", jia)
    code = code:gsub("'(.-)'", jia)

    code = code:gsub('"(.-)"', jia)

    ascll_code = string.sub(ascll_code, 1, -2) .. '}'
    ascll_code2 = string.sub(ascll_code2, 1, -2) .. '}'

    jiemiconfig = 'for k,v in pairs(' .. ascll_name2 ..
                      ')do for kk,vv in pairs(v)do ' .. ascll_name2 ..
                      '[k][kk]=' .. ascll_name .. '[vv-' .. pianyi2 .. ']-' ..
                      pianyi1 .. ' end end\n'
    jiemiconfig = jiemiconfig .. 'for k,v in pairs(' .. ascll_name2 .. ')do ' ..
                      ascll_name2 .. '[k]=string.char(table.unpack(v)) end\n'

    config_code = ascll_code .. '\n' .. ascll_code2 .. '\n' .. jiemiconfig ..
                      '\n'

    code = config_code .. "\n" .. code
    return code
end